package composite.gk2;

import java.util.ArrayList;
import java.util.List;

public class LevelCource extends GkAbstractCource{

    private List<GkAbstractCource> courceList = new ArrayList<>();
    private int level;

    public LevelCource(String name, String score) {
        super(name, score);
    }

    public LevelCource(String name, String score, int level) {
        super(name, score);
        this.level = level;
    }

    public void addChild(GkAbstractCource cource){
        courceList.add(cource);
    }

    @Override
    public void info() {
        System.out.println(this.toString());
        for (GkAbstractCource cource : courceList) {
            for (int i = 0; i < level; i++) {
                System.out.print("·");
            }
            cource.info();
        }
    }

    @Override
    public String toString() {
        return "LevelCource{" +
                "name = "+ super.name+
                "level=" + level +
                '}';
    }
}
